<template>
  <div class="liteflow-editor-app">
    <header class="app-header">
      <h1>LiteFlow Editor Vue2</h1>
      <p>正在逐步遷移 React 版本邏輯，敬請期待。</p>
    </header>
    <main class="app-main">
      <LiteFlowEditor class="editor-wrapper" @ready="handleReady" />
    </main>
  </div>
</template>

<script>
import LiteFlowEditor from './components/LiteFlowEditor.vue';
import { history, setModel, ELBuilder } from './core';

export default {
  name: 'LiteFlowEditorApp',
  components: {
    LiteFlowEditor,
  },
  created() {
    const initialModel = ELBuilder.build([]);
    setModel(initialModel);
  },
  methods: {
    handleReady(graph) {
      history.init(graph);
    },
  },
};
</script>

<style lang="less" scoped>
.liteflow-editor-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f5f7fb;
}

.app-header {
  padding: 24px;
  background: #1f2d3d;
  color: #fff;

  h1 {
    margin: 0 0 8px;
    font-size: 24px;
  }

  p {
    margin: 0;
    font-size: 14px;
    opacity: 0.75;
  }
}

.app-main {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.editor-wrapper {
  flex: 1;
  min-height: 480px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
</style>

